﻿using GSF.Net.Smtp;
using MySqlX.XDevAPI;
using SmartRFIDSystem.Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Mail;
using System.Text;
using System.Threading.Tasks;

namespace SmartRFIDSystem.Model
{
    internal class Mail
    {
        // 发送人服务器
        const string smtpServer = "smtp.exmail.qq.com";
        // 发件人邮箱地址
        const string senderEmail = "skygod@skygodnet.cn";
        // 发件人邮箱密码
        const string senderPassward = "pkgxghxgxrbcub22";
        // 收件人邮箱地址
        string receiverEmail = "2422914906@qq.com";
        // 邮件主题
        string subject = "Hello, World!";
        // 邮件正文
        string body = "This is a test email.";




        // 创建MailMessage对象
        MailMessage mail = new MailMessage();
        

        //// 设置邮件正文格式
        //mail.IsBodyHtml = false;

        //// 创建SmtpClient对象
        //SmtpClient client = new SmtpClient("smtp.example.com", 587);
        //// 设置SmtpClient对象的凭据（发件人邮箱地址和密码）
        //client.Credentials = new NetworkCredential(senderEmail, senderPassword);
        //// 启用SSL加密
        //client.EnableSsl = true;

        //try
        //{
        //    // 发送邮件
        //    client.Send(mail);
        //    Console.WriteLine("邮件发送成功！");
        //}
        //catch (Exception ex)
        //{
        //    Console.WriteLine("邮件发送失败： " + ex.Message);
        //}

        //// 释放资源
        //mail.Dispose();
        //client.Dispose();

    }
}
